package hot100;

import java.util.*;

public class Lc94 {
    public static class TreeNode {
        int val;
        TreeNode left;
        TreeNode right;
        TreeNode() {}
        TreeNode(int val) { this.val = val; }
        TreeNode(int val, TreeNode left, TreeNode right) {
            this.val = val;
            this.left = left;
            this.right = right;
        }
    }

    public List<Integer> inorderTraversal(TreeNode root) {
        List<Integer> ret = new ArrayList<>();
        dfs(root, ret);
        return ret;
    }

    void dfs(TreeNode root, List<Integer> ret) {
        if (root == null) {
            return;
        }
        dfs(root.left, ret);
        ret.add(root.val);
        dfs(root.right, ret);
    }
}
